# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1285654840.6937931
_template_filename='/Users/joeldunham/old/onlinelinguisticdatabase/templates/derived/settings/orthography.html'
_template_uri='/derived/settings/orthography.html'
_template_cache=cache.Cache(__name__, _modified_time)
_source_encoding='utf-8'
from webhelpers.html import escape
_exports = ['writeJavascriptToHead', 'heading']


def _mako_get_namespace(context, name):
    try:
        return context.namespaces[(__name__, name)]
    except KeyError:
        _mako_generate_namespaces(context)
        return context.namespaces[(__name__, name)]
def _mako_generate_namespaces(context):
    # SOURCE LINE 3
    ns = runtime.Namespace(u'javascriptDefs', context._clean_inheritance_tokens(), templateuri=u'/base/javascriptDefs.html', callables=None, calling_uri=_template_uri, module=None)
    context.namespaces[(__name__, u'javascriptDefs')] = ns

def _mako_inherit(template, context):
    _mako_generate_namespaces(context)
    return runtime._inherit_from(context, u'/base/index.html', _template_uri)
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        _import_ns = {}
        _mako_get_namespace(context, u'javascriptDefs')._populate(_import_ns, [u'getCharCodeScript', u'translateOrthographyScript'])
        h = _import_ns.get('h', context.get('h', UNDEFINED))
        c = _import_ns.get('c', context.get('c', UNDEFINED))
        str = _import_ns.get('str', context.get('str', UNDEFINED))
        range = _import_ns.get('range', context.get('range', UNDEFINED))
        len = _import_ns.get('len', context.get('len', UNDEFINED))
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n\n')
        # SOURCE LINE 4
        __M_writer(u'\n\n')
        # SOURCE LINE 9
        __M_writer(u'\n\n')
        # SOURCE LINE 13
        __M_writer(u"\n\n<p>This page provides more details about the object language orthographies.</p>\n\n<p>In particular, it allows users to:</p>\n\n<ul>\n    <li>\n        <a href='#testconvert'>\n            test how well the system converts strings from one orthography to ")
        # SOURCE LINE 23
        __M_writer(u"            another\n        </a>\n    </li>\n    <li>\n        <a href='#entergraphs'>\n            try entering the graphs of the orthographies\n        </a>\n    </li>\n</ul>\n\n\n")
        # SOURCE LINE 34

        options = [(x, c.OLOrthographies[x][0]) for x in c.OLOrthographies if \
          c.OLOrthographies[x][0] and c.OLOrthographies[x][1]]
        
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['x','options'] if __M_key in __M_locals_builtin_stored]))
        # SOURCE LINE 37
        __M_writer(u'\n\n<a name=\'testconvert\'></a>\n<h1 class="heading margintop">Test Orthography Conversion</h1>\n\n<p>Input Orthography</p>\n\n')
        # SOURCE LINE 44
        __M_writer(escape(h.select(name='inputOrthography', id='inputOrthography', \
                selected_values="", options=options, tabindex=1)))
        # SOURCE LINE 45
        __M_writer(u'\n\n<p>Output Orthography</p>\n\n')
        # SOURCE LINE 49
        __M_writer(escape(h.select(name='outputOrthography', id='outputOrthography', \
                selected_values="", options=options, tabindex=2)))
        # SOURCE LINE 50
        __M_writer(u"\n\n<p>Enter some text in the box below using the input orthography selected above.\n</p>\n\n<textarea id='input' name='input' rows='6' style='width:100%;' ")
        # SOURCE LINE 56
        __M_writer(u"          tabindex='3'></textarea>\n\n<p>Press <a onclick='translateOrthography();' ")
        # SOURCE LINE 59
        __M_writer(u'class="buttonLink" title="Translate user-entered text from the input to the ')
        # SOURCE LINE 60
        __M_writer(u'output orthography">Translate</a> to translate your input text into the output\northography selected above.  Your translated text will be displayed below.</p>\n\n<div id=\'outputorthographydiv\'>\n</div>\n\n\n\n')
        # SOURCE LINE 68
        tabindex = 3 
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['tabindex'] if __M_key in __M_locals_builtin_stored]))
        __M_writer(u"\n<a name='entergraphs'></a>\n")
        # SOURCE LINE 70
        for OLOrthography in c.OLOrthographies:
            # SOURCE LINE 71
            if c.OLOrthographies[OLOrthography][1]:
                # SOURCE LINE 72
                __M_writer(u'    <h1 class="heading margintop">')
                __M_writer(escape(c.OLOrthographies[OLOrthography][0]))
                __M_writer(u"</h1>\n      <p>See if you can enter the graphs of this orthography.  For each row\n      in the following table, try entering in the 'Input' column the graph you\n      see in the 'Graph' column.  The unicode character code points of your\n      input will be displayed in the 'Input Codes' column.  If the code points\n      of your input match those of the graph (see the 'Graph Codes' column),\n      then a green checkmark will appear.  Otherwise, a red x mark will appear.\n      </p>\n        <table class='infoTable quarter'>\n            <tr><th>Graph</th><th>Graph Codes</th><th>Input</th><th>Input Codes</th></tr>\n")
                # SOURCE LINE 82
                for index in range(len(c.OLOrthographies[OLOrthography][2])):
                    # SOURCE LINE 83
                    __M_writer(u'            ')

                    inputID = 'input_%s_%s' % (OLOrthography[-1], str(index))
                    divID = 'div_%s_%s' % (OLOrthography[-1], str(index))
                    compareID = 'compare_%s_%s' % (OLOrthography[-1], str(index))
                    tabindex += 1;
                                
                    
                    __M_locals_builtin_stored = __M_locals_builtin()
                    __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['tabindex','compareID','inputID','divID'] if __M_key in __M_locals_builtin_stored]))
                    # SOURCE LINE 88
                    __M_writer(u'\n            <tr>\n                <td>\n                    ')
                    # SOURCE LINE 91
                    __M_writer(escape(c.OLOrthographies[OLOrthography][2][index]))
                    __M_writer(u'\n                </td>\n                <td id="')
                    # SOURCE LINE 93
                    __M_writer(escape(compareID))
                    __M_writer(u'">\n                    ')
                    # SOURCE LINE 94
                    __M_writer(escape(c.OLOrthographies[OLOrthography][3][index]))
                    __M_writer(u'\n                </td>\n                <td>\n                    <input id="')
                    # SOURCE LINE 97
                    __M_writer(escape(inputID))
                    __M_writer(u'" name="')
                    __M_writer(escape(inputID))
                    __M_writer(u'" maxlength="255" ')
                    # SOURCE LINE 98
                    __M_writer(u'                        type="text" class="shortinput" ')
                    # SOURCE LINE 99
                    __M_writer(u'                        onkeyup="getCharCode(\'')
                    __M_writer(escape(inputID))
                    __M_writer(u"', '")
                    __M_writer(escape(divID))
                    __M_writer(u"', ")
                    # SOURCE LINE 100
                    __M_writer(u"                        '")
                    __M_writer(escape(compareID))
                    __M_writer(u'\');" tabindex="')
                    __M_writer(escape(tabindex))
                    __M_writer(u'" />\n                </td>\n                <td>\n                    <div id="')
                    # SOURCE LINE 103
                    __M_writer(escape(divID))
                    __M_writer(u'">\n                    </div>\n                </td>\n            </tr>\n')
                    pass
                # SOURCE LINE 108
                __M_writer(u'        </table>\n')
                pass
            pass
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_writeJavascriptToHead(context):
    context.caller_stack._push_frame()
    try:
        _import_ns = {}
        _mako_get_namespace(context, u'javascriptDefs')._populate(_import_ns, [u'getCharCodeScript', u'translateOrthographyScript'])
        translateOrthographyScript = _import_ns.get('translateOrthographyScript', context.get('translateOrthographyScript', UNDEFINED))
        getCharCodeScript = _import_ns.get('getCharCodeScript', context.get('getCharCodeScript', UNDEFINED))
        __M_writer = context.writer()
        # SOURCE LINE 6
        __M_writer(u'\n    ')
        # SOURCE LINE 7
        __M_writer(escape(getCharCodeScript()))
        __M_writer(u'\n    ')
        # SOURCE LINE 8
        __M_writer(escape(translateOrthographyScript()))
        __M_writer(u'\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_heading(context):
    context.caller_stack._push_frame()
    try:
        _import_ns = {}
        _mako_get_namespace(context, u'javascriptDefs')._populate(_import_ns, [u'getCharCodeScript', u'translateOrthographyScript'])
        __M_writer = context.writer()
        # SOURCE LINE 11
        __M_writer(u'\n    <h1 class="heading">Object Language Orthographies</h1>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


